﻿using Fall.Core.Extensions;
using System;
using System.Reflection;

namespace Fall.Core.Reflaction
{
    public static class AssemblyHelper
    {
        /// <summary>
        /// 根据程序集的名字获取程序集中所有的类型集合
        /// </summary>
        /// <param name="AssemblyName">程序集名字</param>
        /// <returns>类型集合</returns>
        public static Type[] GetTypesByAssemblyName(string AssemblyName)
        {
            Assembly assembly = Assembly.Load(AssemblyName);
            return assembly.GetTypes();
        }

        /// <summary>
        /// 根据程序集的名字获取程序集中所有的类型集合
        /// </summary>
        /// <param name="AssemblyName">程序集名字</param>
        /// <returns>类型集合</returns>
        public static Type[] GetTypesByModuleType(Type moduleType)
        {
            Assembly assembly = moduleType.GetAssembly();
            return assembly.GetTypes();
        }
    }
}
